package cn.zwx.learn.basic.groovy;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @projectName:java-basic
 * @see:groovy
 * @author:zhangwenxue
 * @createTime:2021/4/14 13:20
 * @version:1.0
 */
@Component
public class LoadCommandLineRunner implements CommandLineRunner {

    private Logger logger = LoggerFactory.getLogger(LoadCommandLineRunner.class);

    @Autowired
    private LoadGroovyService groovyService;


    @Override
    public void run(String... args) throws Exception {
       try {
           groovyService.load();
       }catch (Exception e){
            logger.error("加载groovy脚本异常", e);
       }

    }
}
